import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class Main{
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");//加载驱动
        String dbUrl = "jdbc:mysql://localhost:3306/student";
        String dbUserName = "root";
        String dbPassword = "123456";
        Connection conn= DriverManager.getConnection(dbUrl,dbUserName,dbPassword);//链接到数据库 Statement state=conn.createStatement();//容器
       // String sql="select * from info";
       // String sql="insert into info values('李四','12','二班')";
       String sql="delete from info where id='12'";
        //String sql="update info set bj='三班' where id='12' ";
        Statement state=conn.createStatement();
        state.executeUpdate(sql);
        conn.close();
        //ResultSet rs=state.executeQuery(sql);     //将sql语句传至数据库，返回的值为一个字符集用一个变量接收

       // while(rs.next()){    //next（）获取里面的内容
         //   System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
            //getString（n）获取第n列的内容
            //数据库中的列数是从1开始的
        }

    }


